#ifndef LABSERVICE_H
#define LABSERVICE_H

#include <QtGui/QWidget>
#include <QDomDocument>
#include "ui_labservice.h"
#include "usb/WirelessLab.h"
#include "usb/wireless.h"

class QFile;
class QHttp;
class QHttpResponseHeader;
const char HTTP_IDLE=0;
const char HTTP_REQUEST=0x01;
const char HTTP_GETSTATE=0x02;
const char HTTP_REPLY=0x03;

class labservice : public QWidget
{
    Q_OBJECT

public:
    labservice(QWidget *parent = 0);
    ~labservice();
private slots:
    void finddevice();
    void adddevice();
    void usblink();
    void testhttp();
    void bind();
    void httpupdate();
    void testtimeout();
    void readResponseHeader(const QHttpResponseHeader &responseHeader);
    void ReadProgress(int bytesRead, int totalBytes);
    void httpdone (int requestId, bool error);
private:
	Ui::labserviceClass ui;
    WirelessLab * RFLab;
    QHttp *http;
    QFile *bfile;
    QTimer *timer;
    QVector<char> devices; 
    QUrl *serverurl;
    QString res1,res2;
    unsigned short addr;
    int httpgetid;
    int timerover;
    char httpstate;
    bool teststate;
    bool bindstate;
    bool httplock;

};

#endif // LABSERVICE_H
